<?php
// ----- >> Extends From Template
class thisPDF extends PDF{
	function Header(){}
	function Footer(){}
}


// ----- >> Init
$fpdf = new thisPDF('P','mm','A4');
$fpdf->AddPage();
$fpdf->SetLeftMargin(8);

$fpdf->Ln(0);
$ln_header_y_top	= $fpdf->GetY();


// ----- >> Header
$fpdf->Ln(2);

$fpdf->SetFont('Arial','B',14);
$fpdf->Cell(0,5,"LAPORAN PEMBELIAN",0,1,'C');

$fpdf->Ln(10);



// ----- >> Data Master
$fpdf->SetFont('Arial','',10);
$fpdf->Cell(20,5,"No PO",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(60,5,$data['no_po'],0,0,'L');

$fpdf->Cell(20,5,"No STTB",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(20,5,$data['no_sttb'],0,1,'L');



$fpdf->SetFont('Arial','',10);
$fpdf->Cell(20,5,"Tanggal PO",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(60,5,date_format3($data['tgl_order'],'DD MONTH YYYY'),0,0,'L');

$fpdf->Cell(20,5,"Tanggal Terima",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(20,5,date_format3($data['tgl_terima'],'DD MONTH YYYY'),0,1,'L');


$fpdf->SetFont('Arial','',10);
$fpdf->Cell(20,5,"Tanggal Jatuh Tempo",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(60,5,date_format3($data['tgl_jatuh_tempo'],'DD MONTH YYYY'),0,0,'L');

$fpdf->Cell(20,5,"Kode Vendor",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(20,5,numberDisplay($data['kd_vendor'],5),0,1,'L');

$fpdf->SetFont('Arial','',10);
$fpdf->Cell(20,5,"Nama Vendor",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(60,5,$data['nama_vendor'],0,0,'L');

$fpdf->Cell(20,5,"Jenis Pembayaran",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->MultiCell(20,5,$data['jenis_pembayaran'],0,'L');



// ----- >> Detail 1
$fpdf->Ln(10);
$fpdf->SetFont('Arial','B',10);
$fpdf->Cell(25,5,'Tgl Field',1,0,'C');
$fpdf->Cell(0,5,'Keterangan',1,1,'C');
$fpdf->SetFont('Arial','',10);
for($i=0, $max_i=count($arr_detail); $i<$max_i; $i++){
	$row = $arr_detail[$i];
	
	$fpdf->Cell(25,5,$row['nama_barang'],1,0,'L');
	$fpdf->Cell(0,5,$row['qty_order'],1,1,'L');
}


echo $fpdf->Output('CetakSample.pdf', 'I');
exit();
?>